<%@ page language="java" contentType="text/html; charset=UTF-8" pageEncoding="UTF-8"%>
<%@ taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core"%>
<%@ taglib prefix="sec" uri="http://www.springframework.org/security/tags" %>
<%@ taglib prefix="fmt" uri="http://java.sun.com/jsp/jstl/fmt"%>

<fmt:setBundle basename="ApplicationMessage" />
<fmt:setLocale value="zh_CN" />

<!DOCTYPE html>
<html lang="zh-CN">
<head>

  <%@ include file="/WEB-INF/include/meta.jsp"%>
  <%@ include file="/WEB-INF/include/css.jsp"%>
  
</head>

<body>

  <%@ include  file="/WEB-INF/include/header.jsp"%>
  <%@ include file="/WEB-INF/include/menu.jsp"%>
  
  <div class="container main-content">
  
    <div class="panel panel-default x-panel x-panel-layout">
    
      <div class="panel-heading">
        <ol class="breadcrumb">
          <li><a href="${ctx.host}/user">用户管理</a></li>
          <li class="active">学员管理</li>
        </ol>
      </div>
    
      <div class="panel-body">
      
        <div class="col-xs-2 x-panel-layout-left no-horizontal-padding">
          <%@ include file="/WEB-INF/include/submenu.jsp"%>
        </div>
      
        <div class="col-xs-10 x-panel-layout-right">
          <div class="x-breadcrumb-wrapper">
            <div class="x-breadcrumb clearfix">
              <h2><i class="glyphicon glyphicon-fire"></i>&nbsp;&nbsp;<span>${type eq 'online' ? '线上' : '线下'}&nbsp;-&nbsp;录入档案</span></h2>
            </div>
          </div>
          
          <div class="x-toolbar-wrapper top-margin-20 clearfix">
            <div class="btn-group pull-right">
            </div>
          </div>
          
          <form class="form-horizontal" method="POST" action="${ctx.host}/${type}-students/${user.id}/input" data-validate="true" data-redirect="${ctx.host}/${type}-students">
          
            <input type="hidden" name="_method" value="PATCH" />
            <input type="hidden" name="id" value="${user.id}">
          
            <div class="form-group x-form-group">
              <label class="col-xs-2 control-label">学员编号</label>
              <div class="pull-left col-xs-4">
                <input type="text" name="mobile" class="form-control" value="${user.mobile}" readonly="readonly">
              </div>
            </div>
            
            <div class="form-group x-form-group">
              <label class="col-xs-2 control-label">学员姓名</label>
              <div class="pull-left col-xs-4">
                <input type="text" name="name" class="form-control" value="${user.name}" data-validate="required">
              </div>
              
              <label class="col-xs-2 control-label">学员性别</label>
              <div class="pull-left col-xs-4">
                <select name="userFit.gender" class="form-control select2" data-validate="required">
                  <option></option>
                  <c:forEach var="gender" items="${enums['gender']}">
                    <option value="${gender}" ${user.userFit.gender eq gender ? 'selected' : ''}>${gender.description}</option>
                  </c:forEach>
                </select>  
              </div>
            </div>
            
            <div class="form-group x-form-group">
              <label class="col-xs-2 control-label">学员年龄</label>
              <div class="pull-left col-xs-4">
                <input type="text" name="userFit.age" class="form-control" value="${user.userFit.age}" data-validate="required">
              </div>
              
              <label class="col-xs-2 control-label">出生日期</label>
              <div class="pull-left col-xs-4">
                <input type="text" name="profile.birthday" class="form-control" value="${user.profile.birthday}" data-validate="required">
              </div>
            </div>
            
            <div class="form-group x-form-group">
              <label class="col-xs-2 control-label">学员身高</label>
              <div class="pull-left col-xs-4">
                <input type="text" name="userFit.height" class="form-control" value="${user.userFit.height}" data-validate="required" placeholder="cm">
              </div>
              
              <label class="col-xs-2 control-label">学员职业</label>
              <div class="pull-left col-xs-4">
                <select name="remark.position" class="form-control select2" data-validate="required">
                  <option></option>
                  <c:forEach var="userPosition" items="${enums['userPosition']}">
                    <option value="${userPosition.alias}"  ${user.remark.position eq userPosition.alias ? 'selected' : ''}>${userPosition.alias}</option>
                  </c:forEach>
                </select>
              </div>
            </div>
            
            <div class="form-group x-form-group">
              <label class="col-xs-2 control-label">如何得知人马君</label>
              <div class="pull-left col-xs-4">
                <select name="remark.awareChannel" class="form-control select2" data-validate="required">
                  <option></option>
                  <c:forEach var="awareChannel" items="${enums['awareChannel']}">
                    <option value="${awareChannel}" ${user.remark.awareChannel eq awareChannel ? 'selected' : ''}>${awareChannel.description}</option>
                  </c:forEach>
                </select>  
              </div>
              
              <label class="col-xs-2 control-label">学员体重</label>
              <div class="pull-left col-xs-4">
                <input type="text" name="userFit.weight" class="form-control" value="${user.userFit.weight}" placeholder="kg" >
              </div>
            </div>
            
            <div class="form-group x-form-group">
              <label class="col-xs-2 control-label">所在城市</label>
              <div class="pull-left col-xs-3">
                <select name="profile.province" id="loc_province" class="form-control select2" data-validate="required">
                </select> 
              </div>
              
              <div class="pull-left col-xs-3">
                <select name="profile.region" id="loc_city" class="form-control select2" data-validate="required">
                </select> 
              </div>
              
              <div class="pull-left col-xs-4">
                <select name="profile.district" id="loc_town" class="form-control select2" data-validate="required">
                </select> 
              </div>
            </div>
            
            <div class="form-group x-form-group">
              <label class="col-xs-2 control-label">年收入</label>
              <div class="pull-left col-xs-4">
                <select name="remark.salary" class="form-control select2">
                  <option></option>
                  <c:forEach var="userSalary" items="${enums['userSalary']}">
                    <option value="${userSalary.alias}" ${user.remark.salary eq userSalary.alias ? 'selected' : ''}>${userSalary.alias}</option>
                  </c:forEach>
                </select>
              </div>
              
              <label class="col-xs-2 control-label">电子邮箱</label>
              <div class="pull-left col-xs-4">
                <input type="text" name="mailbox" class="form-control" value="${user.mailbox}">
              </div>
            </div>
            
            <div class="form-group x-form-group">
              <label class="col-xs-2 control-label">所在公司类型</label>
              <div class="pull-left col-xs-4">
                <select name="remark.company" class="form-control select2">
                  <option></option>
                  <option value="民营" ${user.remark.company eq '民营' ? 'selected' : ''}>民营</option>
                  <option value="外资" ${user.remark.company eq '外资' ? 'selected' : ''}>外资</option>
                  <option value="中外合资" ${user.remark.company eq '中外合资' ? 'selected' : ''}>中外合资</option>
                  <option value="自由职业" ${user.remark.company eq '自由职业' ? 'selected' : ''}>自由职业</option>
                  <option value="事业单位" ${user.remark.company eq '事业单位' ? 'selected' : ''}>事业单位</option>
                  <option value="国企" ${user.remark.company eq '国企' ? 'selected' : ''}>国企</option>
                  <option value="其他" ${user.remark.company eq '其他' ? 'selected' : ''}>其他</option>
                </select>
              </div>
            
              <label class="col-xs-2 control-label">联系地址</label>
              <div class="pull-left col-xs-4">
                <input type="text" name="profile.address" class="form-control" value="${user.profile.address}" placeholder="-市-区-路-号">
              </div>
            </div>
            
            <div class="form-group x-form-group">
              <label class="col-xs-2 control-label">婚姻状况</label>
              <div class="pull-left col-xs-4">
                <select name="profile.marriage" class="form-control select2">
                  <option></option>
                  <option value="true" ${user.profile.marriage eq true ? 'selected' : ''}>已婚</option>
                  <option value="false" ${user.profile.marriage eq false ? 'selected' : ''}>未婚</option>
                </select>
              </div>
              
              <label class="col-xs-2 control-label">是否有子女</label>
              <div class="pull-left col-xs-4">
                <select name="profile.haveKids" class="form-control select2">
                  <option></option>
                  <option value="true" ${user.profile.haveKids eq true ? 'selected' : ''}>是</option>
                  <option value="false" ${user.profile.haveKids eq false ? 'selected' : ''}>否</option>
                </select>
              </div>
            </div>
            
            <div class="form-group x-form-group">
              <label class="col-xs-2 control-label">兴趣爱好</label>
              <div class="pull-left col-xs-4">
                <input type="text" name="profile.hobby" class="form-control" value="${user.profile.hobby}" multiple >
              </div>
              
              <label class="col-xs-2 control-label">紧急联系方式</label>
              <div class="pull-left col-xs-4">
                <input type="text" name="profile.emergency" class="form-control" value="${user.profile.emergency}">
              </div>
            </div>
            
            <div class="form-group x-form-group">
              <label class="col-xs-2 control-label">来访渠道</label>
              <div class="pull-left col-xs-4">
                <select name="remark.visitChannel" class="form-control select2">
                  <option></option>
                  <c:forEach var="visitChannel" items="${enums['visitChannel']}">
                    <option value="${visitChannel}" ${user.remark.visitChannel eq visitChannel ? 'selected' : ''}>${visitChannel.description}</option>
                  </c:forEach>
                </select>
              </div>
              
              <label class="col-xs-2 control-label">关注健身讯息渠道</label>
              <div class="pull-left col-xs-4" class="form-control select2">
                <select name="remark.followChannel" class="form-control select2">
                  <option></option>
                  <c:forEach var="followChannel" items="${enums['followChannel']}">
                    <option value="${followChannel}" ${user.remark.followChannel eq followChannel ? 'selected' : ''}>${followChannel.description}</option>
                  </c:forEach>
                </select>
              </div>
            </div>
            
            <div class="modal-footer">
              <button type="submit" class="btn btn-success btn-shadow btn-shadow-success x-btn">确定</button>&nbsp;&nbsp;&nbsp;&nbsp;
              <button type="button" class="btn btn-default btn-shadow btn-shadow-default x-btn" data-dismiss="modal" onclick="window.history.back();">取消</button>
            </div>
            
          </form>
          
        </div>
      </div>
    </div>
  </div>
  
  <%@ include file="/WEB-INF/include/script.jsp"%>
  <d:resource root="${ctx.resource}/build" type="script" src="js/page/user/user-input.js">
    <script type="text/javascript">
      require(['page/user/user-input'], function(page) {
        page.init({
          province: '${user.profile.province}',
          region: '${user.profile.region}',
          district: '${user.profile.district}'
        })
      })
    </script>
  </d:resource>
  
</body>
</html>